<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="id" prop="id">
        <el-input
          v-model="queryParams.id"
          placeholder="请输入id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <!-- <el-form-item label="创建人" prop="createBy">
        <el-input
          v-model="queryParams.createBy"
          placeholder="请输入创建人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建时间" prop="createTime">
        <el-date-picker clearable
          v-model="queryParams.createTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择创建时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="最后更新人" prop="updateBy">
        <el-input
          v-model="queryParams.updateBy"
          placeholder="请输入最后更新人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="最后更新时间" prop="updateTime">
        <el-date-picker clearable
          v-model="queryParams.updateTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择最后更新时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="地址_县" prop="addressCounty">
        <el-input
          v-model="queryParams.addressCounty"
          placeholder="请输入地址_县"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="地址_乡" prop="addressTownship">
        <el-input
          v-model="queryParams.addressTownship"
          placeholder="请输入地址_乡"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="行政区域面积" prop="administrativeArea">
        <el-input
          v-model="queryParams.administrativeArea"
          placeholder="请输入行政区域面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="苹果播种面积" prop="appleSownArea">
        <el-input
          v-model="queryParams.appleSownArea"
          placeholder="请输入苹果播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="香蕉播种面积" prop="bananaSownArea">
        <el-input
          v-model="queryParams.bananaSownArea"
          placeholder="请输入香蕉播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="甜菜播种面积" prop="beetSownArea">
        <el-input
          v-model="queryParams.beetSownArea"
          placeholder="请输入甜菜播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="柑桔播种面积" prop="citrusSownArea">
        <el-input
          v-model="queryParams.citrusSownArea"
          placeholder="请输入柑桔播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="联系电话" prop="contactPhone">
        <el-input
          v-model="queryParams.contactPhone"
          placeholder="请输入联系电话"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="玉米播种面积" prop="cornSownArea">
        <el-input
          v-model="queryParams.cornSownArea"
          placeholder="请输入玉米播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="棉花播种面积" prop="cottonSownArea">
        <el-input
          v-model="queryParams.cottonSownArea"
          placeholder="请输入棉花播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="填写说明" prop="fillingInstructions">
        <el-input
          v-model="queryParams.fillingInstructions"
          placeholder="请输入填写说明"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="烤烟播种面积" prop="flueCuredTobaccoSownArea">
        <el-input
          v-model="queryParams.flueCuredTobaccoSownArea"
          placeholder="请输入烤烟播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="填表人" prop="formFiller">
        <el-input
          v-model="queryParams.formFiller"
          placeholder="请输入填表人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="葡萄播种面积" prop="grapeSownArea">
        <el-input
          v-model="queryParams.grapeSownArea"
          placeholder="请输入葡萄播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="青稞播种面积" prop="highlandBarleySownArea">
        <el-input
          v-model="queryParams.highlandBarleySownArea"
          placeholder="请输入青稞播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="红枣播种面积" prop="jujubeSownArea">
        <el-input
          v-model="queryParams.jujubeSownArea"
          placeholder="请输入红枣播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="药材播种面积" prop="medicinalCropsSownArea">
        <el-input
          v-model="queryParams.medicinalCropsSownArea"
          placeholder="请输入药材播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="甜瓜播种面积" prop="melonSownArea">
        <el-input
          v-model="queryParams.melonSownArea"
          placeholder="请输入甜瓜播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="花生播种面积" prop="peanutSownArea">
        <el-input
          v-model="queryParams.peanutSownArea"
          placeholder="请输入花生播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="梨播种面积" prop="pearSownArea">
        <el-input
          v-model="queryParams.pearSownArea"
          placeholder="请输入梨播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="柿子播种面积" prop="persimmonSownArea">
        <el-input
          v-model="queryParams.persimmonSownArea"
          placeholder="请输入柿子播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="菠萝播种面积" prop="pineappleSownArea">
        <el-input
          v-model="queryParams.pineappleSownArea"
          placeholder="请输入菠萝播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="马铃薯播种面积" prop="potatoSownArea">
        <el-input
          v-model="queryParams.potatoSownArea"
          placeholder="请输入马铃薯播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="油菜籽播种面积" prop="rapeseedSownArea">
        <el-input
          v-model="queryParams.rapeseedSownArea"
          placeholder="请输入油菜籽播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="报出日期" prop="reportDate">
        <el-input
          v-model="queryParams.reportDate"
          placeholder="请输入报出日期"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="水稻播种面积" prop="riceSownArea">
        <el-input
          v-model="queryParams.riceSownArea"
          placeholder="请输入水稻播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="高粱播种面积" prop="sorghumSownArea">
        <el-input
          v-model="queryParams.sorghumSownArea"
          placeholder="请输入高粱播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="大豆播种面积" prop="soybeanSownArea">
        <el-input
          v-model="queryParams.soybeanSownArea"
          placeholder="请输入大豆播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="特色农作物种类" prop="specialCropsTypes">
        <el-input
          v-model="queryParams.specialCropsTypes"
          placeholder="请输入特色农作物种类"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="统计负责人" prop="statisticsResponsiblePerson">
        <el-input
          v-model="queryParams.statisticsResponsiblePerson"
          placeholder="请输入统计负责人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="草莓播种面积" prop="strawberrySownArea">
        <el-input
          v-model="queryParams.strawberrySownArea"
          placeholder="请输入草莓播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="甘蔗播种面积" prop="sugarcaneSownArea">
        <el-input
          v-model="queryParams.sugarcaneSownArea"
          placeholder="请输入甘蔗播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="甘薯播种面积" prop="sweetPotatoSownArea">
        <el-input
          v-model="queryParams.sweetPotatoSownArea"
          placeholder="请输入甘薯播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="茶叶播种面积" prop="teaSownArea">
        <el-input
          v-model="queryParams.teaSownArea"
          placeholder="请输入茶叶播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="烟叶播种面积" prop="tobaccoSownArea">
        <el-input
          v-model="queryParams.tobaccoSownArea"
          placeholder="请输入烟叶播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="农作物总播种面积" prop="totalCropsSownArea">
        <el-input
          v-model="queryParams.totalCropsSownArea"
          placeholder="请输入农作物总播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="单位负责人" prop="unitResponsiblePerson">
        <el-input
          v-model="queryParams.unitResponsiblePerson"
          placeholder="请输入单位负责人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="蔬菜播种面积" prop="vegetableSownArea">
        <el-input
          v-model="queryParams.vegetableSownArea"
          placeholder="请输入蔬菜播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="西瓜播种面积" prop="watermelonSownArea">
        <el-input
          v-model="queryParams.watermelonSownArea"
          placeholder="请输入西瓜播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="小麦播种面积" prop="wheatSownArea">
        <el-input
          v-model="queryParams.wheatSownArea"
          placeholder="请输入小麦播种面积"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['ybyj:indexTown:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['ybyj:indexTown:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['ybyj:indexTown:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['ybyj:indexTown:export']"
        >导出</el-button>
      </el-col>
      <el-col :span="1.5">
        <excelImport url="/ybyj/indexTown/import" @onSuccess="handleQuery" />
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="indexTownList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="id" align="center" prop="id" v-if="true"/>
      <el-table-column label="创建人" align="center" prop="createBy" />
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="最后更新人" align="center" prop="updateBy" />
      <el-table-column label="最后更新时间" align="center" prop="updateTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="地址_县" align="center" prop="addressCounty" />
      <el-table-column label="地址_乡" align="center" prop="addressTownship" />
      <el-table-column label="行政区域面积" align="center" prop="administrativeArea" />
      <el-table-column label="苹果播种面积" align="center" prop="appleSownArea" />
      <el-table-column label="香蕉播种面积" align="center" prop="bananaSownArea" />
      <el-table-column label="甜菜播种面积" align="center" prop="beetSownArea" />
      <el-table-column label="柑桔播种面积" align="center" prop="citrusSownArea" />
      <el-table-column label="联系电话" align="center" prop="contactPhone" />
      <el-table-column label="玉米播种面积" align="center" prop="cornSownArea" />
      <el-table-column label="棉花播种面积" align="center" prop="cottonSownArea" />
      <el-table-column label="填写说明" align="center" prop="fillingInstructions" />
      <el-table-column label="烤烟播种面积" align="center" prop="flueCuredTobaccoSownArea" />
      <el-table-column label="填表人" align="center" prop="formFiller" />
      <el-table-column label="葡萄播种面积" align="center" prop="grapeSownArea" />
      <el-table-column label="青稞播种面积" align="center" prop="highlandBarleySownArea" />
      <el-table-column label="红枣播种面积" align="center" prop="jujubeSownArea" />
      <el-table-column label="药材播种面积" align="center" prop="medicinalCropsSownArea" />
      <el-table-column label="甜瓜播种面积" align="center" prop="melonSownArea" />
      <el-table-column label="花生播种面积" align="center" prop="peanutSownArea" />
      <el-table-column label="梨播种面积" align="center" prop="pearSownArea" />
      <el-table-column label="柿子播种面积" align="center" prop="persimmonSownArea" />
      <el-table-column label="菠萝播种面积" align="center" prop="pineappleSownArea" />
      <el-table-column label="马铃薯播种面积" align="center" prop="potatoSownArea" />
      <el-table-column label="油菜籽播种面积" align="center" prop="rapeseedSownArea" />
      <el-table-column label="报出日期" align="center" prop="reportDate" />
      <el-table-column label="水稻播种面积" align="center" prop="riceSownArea" />
      <el-table-column label="高粱播种面积" align="center" prop="sorghumSownArea" />
      <el-table-column label="大豆播种面积" align="center" prop="soybeanSownArea" />
      <el-table-column label="特色农作物种类" align="center" prop="specialCropsTypes" />
      <el-table-column label="统计负责人" align="center" prop="statisticsResponsiblePerson" />
      <el-table-column label="草莓播种面积" align="center" prop="strawberrySownArea" />
      <el-table-column label="甘蔗播种面积" align="center" prop="sugarcaneSownArea" />
      <el-table-column label="甘薯播种面积" align="center" prop="sweetPotatoSownArea" />
      <el-table-column label="茶叶播种面积" align="center" prop="teaSownArea" />
      <el-table-column label="烟叶播种面积" align="center" prop="tobaccoSownArea" />
      <el-table-column label="农作物总播种面积" align="center" prop="totalCropsSownArea" />
      <el-table-column label="单位负责人" align="center" prop="unitResponsiblePerson" />
      <el-table-column label="蔬菜播种面积" align="center" prop="vegetableSownArea" />
      <el-table-column label="核实状态" align="center" prop="verificationStatus" />
      <el-table-column label="西瓜播种面积" align="center" prop="watermelonSownArea" />
      <el-table-column label="小麦播种面积" align="center" prop="wheatSownArea" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['ybyj:indexTown:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['ybyj:indexTown:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改乡镇基础指标统计对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="创建人" prop="createBy">
          <el-input-number v-model="form.createBy" placeholder="请输入创建人" />
        </el-form-item>
        <el-form-item label="创建时间" prop="createTime">
          <el-date-picker clearable
            v-model="form.createTime"
            type="datetime"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="请选择创建时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="最后更新人" prop="updateBy">
          <el-input-number v-model="form.updateBy" placeholder="请输入最后更新人" />
        </el-form-item>
        <el-form-item label="最后更新时间" prop="updateTime">
          <el-date-picker clearable
            v-model="form.updateTime"
            type="datetime"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="请选择最后更新时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="地址_县" prop="addressCounty">
          <el-input v-model="form.addressCounty" placeholder="请输入地址_县" />
        </el-form-item>
        <el-form-item label="地址_乡" prop="addressTownship">
          <el-input v-model="form.addressTownship" placeholder="请输入地址_乡" />
        </el-form-item>
        <el-form-item label="行政区域面积" prop="administrativeArea">
          <el-input-number v-model="form.administrativeArea" placeholder="请输入行政区域面积" />
        </el-form-item>
        <el-form-item label="苹果播种面积" prop="appleSownArea">
          <el-input-number v-model="form.appleSownArea" placeholder="请输入苹果播种面积" />
        </el-form-item>
        <el-form-item label="香蕉播种面积" prop="bananaSownArea">
          <el-input-number v-model="form.bananaSownArea" placeholder="请输入香蕉播种面积" />
        </el-form-item>
        <el-form-item label="甜菜播种面积" prop="beetSownArea">
          <el-input-number v-model="form.beetSownArea" placeholder="请输入甜菜播种面积" />
        </el-form-item>
        <el-form-item label="柑桔播种面积" prop="citrusSownArea">
          <el-input-number v-model="form.citrusSownArea" placeholder="请输入柑桔播种面积" />
        </el-form-item>
        <el-form-item label="联系电话" prop="contactPhone">
          <el-input v-model="form.contactPhone" placeholder="请输入联系电话" />
        </el-form-item>
        <el-form-item label="玉米播种面积" prop="cornSownArea">
          <el-input-number v-model="form.cornSownArea" placeholder="请输入玉米播种面积" />
        </el-form-item>
        <el-form-item label="棉花播种面积" prop="cottonSownArea">
          <el-input-number v-model="form.cottonSownArea" placeholder="请输入棉花播种面积" />
        </el-form-item>
        <el-form-item label="填写说明" prop="fillingInstructions">
          <el-input v-model="form.fillingInstructions" placeholder="请输入填写说明" />
        </el-form-item>
        <el-form-item label="烤烟播种面积" prop="flueCuredTobaccoSownArea">
          <el-input-number v-model="form.flueCuredTobaccoSownArea" placeholder="请输入烤烟播种面积" />
        </el-form-item>
        <el-form-item label="填表人" prop="formFiller">
          <el-input v-model="form.formFiller" placeholder="请输入填表人" />
        </el-form-item>
        <el-form-item label="葡萄播种面积" prop="grapeSownArea">
          <el-input-number v-model="form.grapeSownArea" placeholder="请输入葡萄播种面积" />
        </el-form-item>
        <el-form-item label="青稞播种面积" prop="highlandBarleySownArea">
          <el-input-number v-model="form.highlandBarleySownArea" placeholder="请输入青稞播种面积" />
        </el-form-item>
        <el-form-item label="红枣播种面积" prop="jujubeSownArea">
          <el-input-number v-model="form.jujubeSownArea" placeholder="请输入红枣播种面积" />
        </el-form-item>
        <el-form-item label="药材播种面积" prop="medicinalCropsSownArea">
          <el-input-number v-model="form.medicinalCropsSownArea" placeholder="请输入药材播种面积" />
        </el-form-item>
        <el-form-item label="甜瓜播种面积" prop="melonSownArea">
          <el-input-number v-model="form.melonSownArea" placeholder="请输入甜瓜播种面积" />
        </el-form-item>
        <el-form-item label="花生播种面积" prop="peanutSownArea">
          <el-input-number v-model="form.peanutSownArea" placeholder="请输入花生播种面积" />
        </el-form-item>
        <el-form-item label="梨播种面积" prop="pearSownArea">
          <el-input-number v-model="form.pearSownArea" placeholder="请输入梨播种面积" />
        </el-form-item>
        <el-form-item label="柿子播种面积" prop="persimmonSownArea">
          <el-input-number v-model="form.persimmonSownArea" placeholder="请输入柿子播种面积" />
        </el-form-item>
        <el-form-item label="菠萝播种面积" prop="pineappleSownArea">
          <el-input-number v-model="form.pineappleSownArea" placeholder="请输入菠萝播种面积" />
        </el-form-item>
        <el-form-item label="马铃薯播种面积" prop="potatoSownArea">
          <el-input-number v-model="form.potatoSownArea" placeholder="请输入马铃薯播种面积" />
        </el-form-item>
        <el-form-item label="油菜籽播种面积" prop="rapeseedSownArea">
          <el-input-number v-model="form.rapeseedSownArea" placeholder="请输入油菜籽播种面积" />
        </el-form-item>
        <el-form-item label="报出日期" prop="reportDate">
          <el-input v-model="form.reportDate" placeholder="请输入报出日期" />
        </el-form-item>
        <el-form-item label="水稻播种面积" prop="riceSownArea">
          <el-input-number v-model="form.riceSownArea" placeholder="请输入水稻播种面积" />
        </el-form-item>
        <el-form-item label="高粱播种面积" prop="sorghumSownArea">
          <el-input-number v-model="form.sorghumSownArea" placeholder="请输入高粱播种面积" />
        </el-form-item>
        <el-form-item label="大豆播种面积" prop="soybeanSownArea">
          <el-input-number v-model="form.soybeanSownArea" placeholder="请输入大豆播种面积" />
        </el-form-item>
        <el-form-item label="特色农作物种类" prop="specialCropsTypes">
          <el-input v-model="form.specialCropsTypes" placeholder="请输入特色农作物种类" />
        </el-form-item>
        <el-form-item label="统计负责人" prop="statisticsResponsiblePerson">
          <el-input v-model="form.statisticsResponsiblePerson" placeholder="请输入统计负责人" />
        </el-form-item>
        <el-form-item label="草莓播种面积" prop="strawberrySownArea">
          <el-input-number v-model="form.strawberrySownArea" placeholder="请输入草莓播种面积" />
        </el-form-item>
        <el-form-item label="甘蔗播种面积" prop="sugarcaneSownArea">
          <el-input-number v-model="form.sugarcaneSownArea" placeholder="请输入甘蔗播种面积" />
        </el-form-item>
        <el-form-item label="甘薯播种面积" prop="sweetPotatoSownArea">
          <el-input-number v-model="form.sweetPotatoSownArea" placeholder="请输入甘薯播种面积" />
        </el-form-item>
        <el-form-item label="茶叶播种面积" prop="teaSownArea">
          <el-input-number v-model="form.teaSownArea" placeholder="请输入茶叶播种面积" />
        </el-form-item>
        <el-form-item label="烟叶播种面积" prop="tobaccoSownArea">
          <el-input-number v-model="form.tobaccoSownArea" placeholder="请输入烟叶播种面积" />
        </el-form-item>
        <el-form-item label="农作物总播种面积" prop="totalCropsSownArea">
          <el-input-number v-model="form.totalCropsSownArea" placeholder="请输入农作物总播种面积" />
        </el-form-item>
        <el-form-item label="单位负责人" prop="unitResponsiblePerson">
          <el-input v-model="form.unitResponsiblePerson" placeholder="请输入单位负责人" />
        </el-form-item>
        <el-form-item label="蔬菜播种面积" prop="vegetableSownArea">
          <el-input-number v-model="form.vegetableSownArea" placeholder="请输入蔬菜播种面积" />
        </el-form-item>
        <el-form-item label="西瓜播种面积" prop="watermelonSownArea">
          <el-input-number v-model="form.watermelonSownArea" placeholder="请输入西瓜播种面积" />
        </el-form-item>
        <el-form-item label="小麦播种面积" prop="wheatSownArea">
          <el-input-number v-model="form.wheatSownArea" placeholder="请输入小麦播种面积" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listIndexTown, getIndexTown, delIndexTown, addIndexTown, updateIndexTown } from "@/api/ybyj/indexTown";
import DynamicSelect from "@/components/DynamicSelect";
import AutoCompute from "@/components/AutoCompute";

export default {
  name: "IndexTown",
  components: { DynamicSelect, AutoCompute },
  data() {
    return {
      // 按钮loading
      buttonLoading: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 乡镇基础指标统计表格数据
      indexTownList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        id: undefined,
        createBy: undefined,
        createTime: undefined,
        updateBy: undefined,
        updateTime: undefined,
        addressCounty: undefined,
        addressTownship: undefined,
        administrativeArea: undefined,
        appleSownArea: undefined,
        bananaSownArea: undefined,
        beetSownArea: undefined,
        citrusSownArea: undefined,
        contactPhone: undefined,
        cornSownArea: undefined,
        cottonSownArea: undefined,
        fillingInstructions: undefined,
        flueCuredTobaccoSownArea: undefined,
        formFiller: undefined,
        grapeSownArea: undefined,
        highlandBarleySownArea: undefined,
        jujubeSownArea: undefined,
        medicinalCropsSownArea: undefined,
        melonSownArea: undefined,
        peanutSownArea: undefined,
        pearSownArea: undefined,
        persimmonSownArea: undefined,
        pineappleSownArea: undefined,
        potatoSownArea: undefined,
        rapeseedSownArea: undefined,
        reportDate: undefined,
        riceSownArea: undefined,
        sorghumSownArea: undefined,
        soybeanSownArea: undefined,
        specialCropsTypes: undefined,
        statisticsResponsiblePerson: undefined,
        strawberrySownArea: undefined,
        sugarcaneSownArea: undefined,
        sweetPotatoSownArea: undefined,
        teaSownArea: undefined,
        tobaccoSownArea: undefined,
        totalCropsSownArea: undefined,
        unitResponsiblePerson: undefined,
        vegetableSownArea: undefined,
        verificationStatus: undefined,
        watermelonSownArea: undefined,
        wheatSownArea: undefined
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询乡镇基础指标统计列表 */
    getList() {
      this.loading = true;
      listIndexTown(this.queryParams).then(response => {
       Promise.all(
                [
                ]
              ).then(() => {
                this.indexTownList = response.rows;
                this.total = response.total;
                this.loading = false;
            })
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        createBy: undefined,
        createTime: undefined,
        deleted: undefined,
        updateBy: undefined,
        updateTime: undefined,
        addressCounty: undefined,
        addressTownship: undefined,
        administrativeArea: undefined,
        appleSownArea: undefined,
        bananaSownArea: undefined,
        beetSownArea: undefined,
        citrusSownArea: undefined,
        contactPhone: undefined,
        cornSownArea: undefined,
        cottonSownArea: undefined,
        fillingInstructions: undefined,
        flueCuredTobaccoSownArea: undefined,
        formFiller: undefined,
        grapeSownArea: undefined,
        highlandBarleySownArea: undefined,
        jujubeSownArea: undefined,
        medicinalCropsSownArea: undefined,
        melonSownArea: undefined,
        peanutSownArea: undefined,
        pearSownArea: undefined,
        persimmonSownArea: undefined,
        pineappleSownArea: undefined,
        potatoSownArea: undefined,
        rapeseedSownArea: undefined,
        reportDate: undefined,
        riceSownArea: undefined,
        sorghumSownArea: undefined,
        soybeanSownArea: undefined,
        specialCropsTypes: undefined,
        statisticsResponsiblePerson: undefined,
        strawberrySownArea: undefined,
        sugarcaneSownArea: undefined,
        sweetPotatoSownArea: undefined,
        teaSownArea: undefined,
        tobaccoSownArea: undefined,
        totalCropsSownArea: undefined,
        unitResponsiblePerson: undefined,
        vegetableSownArea: undefined,
        verificationStatus: "0",
        watermelonSownArea: undefined,
        wheatSownArea: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加乡镇基础指标统计";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.loading = true;
      this.reset();
      const id = row.id || this.ids
      getIndexTown(id).then(response => {
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = "修改乡镇基础指标统计";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.buttonLoading = true;
          if (this.form.id != null) {
            updateIndexTown(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          } else {
            addIndexTown(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除').then(() => {
        this.loading = true;
        return delIndexTown(ids);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      }).finally(() => {
        this.loading = false;
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('ybyj/indexTown/export', {
        ...this.queryParams
      }, `indexTown_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
